<?php



/**

 * C2C电子商务 起始页控制器

 * ============================================================================

 * 版权所有 2010-2020 广州网畅信息科技有限公司，并保留所有权利。

 * 网站地址: http://www.68ws.com；

 * ----------------------------------------------------------------------------

 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和

 * 使用；不允许对程序代码以任何形式任何目的的再发布。

 * ============================================================================

 * $Author: 68ws.com $

 *  $Id: default.app.php  2010-07-24 09:19:16Z 68ws.com $

*/

class GdetailApp extends MallbaseApp

{

    function index()

    {

        $this->assign('index', 1); // 标识当前页面是首页，用于设置导航状态

        $this->assign('icp_number', Conf::get('icp_number'));

 		

        /* 热门搜素 */

        $this->assign('hot_keywords', $this->_get_hot_keywords());

		/*------add by tianya--------*/

		//$this->assign('search_keywords', $this->_get_search_keywords());

        $goods_id=$_GET['id'];

		$result=mysql_query("SELECT goods_name FROM ecm_goods WHERE goods_id=$goods_id") or die(mysql_error());

		list($goods_name)=mysql_fetch_array($result);

        $this->assign('page_title', "$goods_name");

        

        $this->assign('page_description', "$goods_name");

        $this->assign('page_keywords', "$goods_name");

         //$cate_id = isset($param['cate_id']) ? $param['cate_id'] : 0;

        $this->_curlocal($this->_get_goods_curlocal($cate_id));

        $this->display('gdetail.goods.html');

    }



    function _get_hot_keywords()

    {

        $keywords = explode(',', conf::get('hot_search'));

        return $keywords;

    }

	 /*function _get_search_keywords()

    {

        $model_keywords =& m('keywords'); 

		      

        $data = $model_keywords->find(array(

			'order'   	  => 'view DESC',

			'fields' 	  => 'keywords,view',

        )); 

		foreach ($data as $key => $val)

        {

           $skeywords .= $val['keywords'].",";  

        }

        return $skeywords;

    }*/

	

    	 function _get_goods_curlocal($cate_id)



    {



        $parents = array();



        if ($cate_id)



        {



            $gcategory_mod =& bm('gcategory');



            $parents = $gcategory_mod->get_ancestor($cate_id, true);



        }







        $curlocal = array(



            array('text' => LANG::get('all_categories'), 'url' => "javascript:dropParam('cate_id')"),



        );



        foreach ($parents as $category)



        {



            $curlocal[] = array('text' => $category['cate_name'], 'url' => "javascript:replaceParam('cate_id', '" . $category['cate_id'] . "')");



        }



        unset($curlocal[count($curlocal) - 1]['url']);







        return $curlocal;



    }



}



?>